

import 'package:favourcate/core/extension/int_fit_ext.dart';
import 'package:favourcate/core/model/category_model.dart';
import 'package:favourcate/ui/pages/meal/meal.dart';
import 'package:flutter/material.dart';

class GLHomeCategoryItem extends StatelessWidget {
  const GLHomeCategoryItem(this._category, { Key? key }) : super(key: key);
  final GLCategoryModel _category;

  @override
  Widget build(BuildContext context) {
    final bgColor = _category.cColor;

    return GestureDetector(
      child: Container(
        decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(12.px),
          color: _category.cColor,
          gradient: LinearGradient(
            colors: [
              bgColor.withOpacity(0.5),
              bgColor
            ]
          )
        ),
        alignment: Alignment.center,
        child: Text(
          _category.title,
          style: Theme.of(context).textTheme.headline2?.copyWith(
            fontWeight: FontWeight.bold,
            color: Colors.black
          ),
        ),
        
      ),
      onTap: () {
        Navigator.of(context).pushNamed(GLMealScreen.routeName, arguments: _category);
      },
    );
    
  }
}